select * from resources WHERE hash = 'Unable to access file'
select * from resourcesuris WHERE hostName = 'HP0085'
select * from resourcesuris WHERE uri like '\\etfsinc.com\%'
select count(*) from Resources
select count(*) from ResourcesUris WHERE uri LIKE 'C:\Tools\%' Collate SQL_Latin1_General_CP1_CS_AS
delete from Resources WHERE hash = 'Unable to access file'
delete from ResourcesUris WHERE resourceHash = 'Unable to access file'
delete from ResourcesURIs WHERE uri like '\\etfsinc.com\%'
delete from ResourcesUris WHERE uri LIKE 'X:\%' Collate SQL_Latin1_General_CP1_CS_AS
delete from ResourcesURIs WHERE hostName = 'HP0085'
select COUNT(hash) from resources group by hash having count(hash) >1

select uri,hostName,owner,lastModifiedDate,createdDate,inventoryDate,resourceHash 
from ResourcesURIs 
where resourceHash in (SELECT resourceHash 
						from ResourcesURIs
						GROUP BY resourceHash
						HAVING COUNT(*) > 1) --AND
-- hostName IN (@hostName) AND
--uri LIKE @uri
ORDER BY resourcehash

SELECT *
FROM Resources r INNER JOIN ResourcesURIs ru
					ON r.hash = ru.resourceHash
where uri like 'X:\Archives\%'
GROUP BY owner
ORDER BY owner ASC

SELECT uri, COUNT(uri)
FROM ResourcesURIs
GROUP BY uri
HAVING COUNT(uri) > 1

SELECT extension, SUM(CAST(sizeInBytes AS FLOAT)/1024/1024) AS sizeInMB
FROM Resources r INNER JOIN ResourcesURIs ru
					ON r.hash = ru.resourceHash
GROUP BY extension
ORDER BY extension ASC

SELECT

REVERSE(SUBSTRING(REVERSE(REVERSE(SUBSTRING(REVERSE(uri),0,CHARINDEX('\',REVERSE(uri))))),0,CHARINDEX('.',REVERSE(REVERSE(SUBSTRING(REVERSE(uri),0,CHARINDEX('\',REVERSE(uri))))))))
FROM ResourcesUris